package DailyPractice.Day11;

/**
 * 公共祖先
 * @author lumin
 * @date 2022/05/06 19:48
 **/
public class Num1 {
    public static int getLCA(int a, int b) {
        // write code here
        while (a != b) {
            if (a > b) {
                a /= 2;
            } else {
                b /= 2;
            }
        }
        return b;
    }

    public static void main(String[] args) {
        int a = 2;
        int b = 3;
        System.out.println(getLCA(a, b));
    }
}